var express = require('express');
var router = express.Router();
var path = require('path');
const { use } = require('./users');
var sqlite3 = require('sqlite3').verbose();

/* GET home page. */
router.get('/', function(req, res, next) {
  var db=new sqlite3.Database(path.join(__dirname, "../public/db/data.s3db"));
  sqlStr1="SELECT * from no2"
  db.all(sqlStr1,function(err,row){
    if (err) throw err
    else {
        //console.log(row)
        if(row.length!=0)
        {
          console.log("row:",row)
          res.send(row);
        }else{
            res.send('-1');
        }  
    }
  });
  db.close();
});

module.exports = router;
